package com.example.xd.mvp_project.net;


import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;

/**
 * @auther XuDan on 2018/10/16.
 */
public class HttpClient {
    private static HttpClient instance;
    private OkHttpClient.Builder builder;

    public HttpClient() {
        builder = new OkHttpClient.Builder()
                .connectTimeout(5, TimeUnit.SECONDS)
                .writeTimeout(30, TimeUnit.SECONDS);
    }

    public static HttpClient getInstance() {
        if (instance == null) {
            synchronized (HttpClient.class) {
                if (instance == null) {
                    instance = new HttpClient();
                }

            }
        }
        return instance;
    }

    public OkHttpClient.Builder getBuilder() {
        return builder;
    }

}
